Skip to content

fix(release): override the scope registry, and dual-publish the npm package - #11

Merged
Radiergummi merged 2 commits into
mainfrom
fix/scope-registry-and-dual-publish
Jul 30, 2026
Merged

fix(release): override the scope registry, and dual-publish the npm package#11
Radiergummi merged 2 commits into
mainfrom
fix/scope-registry-and-dual-publish

Conversation

@Radiergummi

Copy link
Copy Markdown
Member

These two commits were pushed to chore/pin-npm-exactly after PR #10 had already merged, so they never reached main. Replayed onto main here.

main is currently in a state that would misbehave, which is why this matters rather than being tidy-up.

1. The registry override on main does not work

main pins --registry https://registry.npmjs.org. For a scoped package npm resolves the registry from @scope:registry and only falls back to the generic registry key that --registry sets — so any scope mapping outranks it.

This was found by publishing to the wrong place: npm publish --registry https://registry.npmjs.org sent the placeholder to GitHub Packages, because a developer .npmrc maps @matchory there. Both --registry and publishConfig.registry were overridden.

Fixed to --@matchory:registry=, which sets the key that actually wins. Also replaces the previous config-inspection warning with a real gate: a dry-run publish using the exact flags, asserting the reported target is npmjs and refusing to proceed otherwise. That tests resolved behaviour instead of reasoning about precedence — the mistake that caused this.

This is load-bearing because libnpmpublish never validates the destination registry, so a provenance-signed release could land somewhere unintended and npm would sign it regardless.

2. Dual publish

npm resolves registries per scope with no per-package override. @matchory/ui is proprietary and lives on GitHub Packages, so any repository consuming it maps the whole @matchory scope there and would never find this package on npmjs.

The same attested tarball now goes to both, byte-identical with the SHA-256 verified before each upload. npmjs stays canonical — public, and the copy carrying provenance. GitHub Packages authenticates with the job's GITHUB_TOKEN, so no new credential, in the same gated release environment.

--provenance is omitted for GitHub Packages deliberately: it neither displays nor verifies npm provenance, so a second statement would be a claim nobody can check. The shared GitHub artefact attestation covers both copies.

Retargeting was verified empirically in both directions rather than trusted.

Radiergummi and others added 2 commits July 30, 2026 15:00
The `--registry` pin added in the previous commit does not work for a
scoped package, and I found out by publishing to the wrong registry.

npm resolves the registry for `@matchory/coding-style` from
`@matchory:registry`, falling back to the generic `registry` key only when
the scope key is unset. `--registry` sets the generic key, so it loses to
any scope mapping. Publishing the placeholder with
`--registry https://registry.npmjs.org` sent it to GitHub Packages,
because a developer .npmrc maps the @matchory scope there. Both
`publishConfig.registry` and `--registry` were outranked.

`--@matchory:registry=` sets the key that actually wins. Verified against
all three combinations by dry-run: `--registry` alone does not retarget,
the scope override does.

This matters beyond tidiness because libnpmpublish never validates the
destination registry, so a provenance-signed release could have landed
somewhere unintended and npm would have signed it regardless.

Replaced the previous config-inspection warning with a real gate: a
dry-run publish using the exact flags, asserting the reported target is
npmjs. That tests the resolved behaviour instead of guessing at
precedence, which is the mistake that caused this.

The stray 0.0.0 in GitHub Packages is harmless in itself, but it exposed a
design problem that needs a decision: @matchory/ui is on GitHub Packages
while @matchory/coding-style is headed for npmjs, and npm registry
configuration is per-scope with no per-package override. A consuming
repository therefore cannot take one @matchory package from each.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CEdTd43qLEEE5qCsL1A7gW
npm resolves a registry per scope and offers no per-package override.
`@matchory/ui` is proprietary and lives on GitHub Packages, so any
repository consuming it maps the whole `@matchory` scope there — and would
never find this package on npmjs. Publishing to one registry only would
have meant every internal consumer either cannot install this package or
must stop consuming `@matchory/ui` the way it does today.

So the same attested tarball goes to both. Byte-identical, with the
SHA-256 verified before each upload, which is what makes "identical"
checkable rather than asserted.

npmjs stays canonical: public, and the copy that carries the provenance
statement. GitHub Packages authenticates with the job's GITHUB_TOKEN, so
dual publishing introduces no new credential, and runs in the same gated
`release` environment behind the same approval.

--provenance is deliberately omitted for GitHub Packages. It neither
displays nor verifies npm provenance statements, so a second statement
there would be a claim nobody can check; the shared GitHub artefact
attestation covers both copies.

Verified the retargeting empirically in both directions rather than
trusting precedence rules, having already been wrong about them once: the
scope override sends the publish to GitHub Packages (proved by the
"cannot publish over previously published 0.0.0" conflict, since the
misdirected placeholder is there) and to npmjs (clean dry-run).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CEdTd43qLEEE5qCsL1A7gW
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Radiergummi
Radiergummi merged commit edbc82c into main Jul 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant